<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>slibc: slibc/string_templates_.hpp File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">slibc
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_4d4a740b65ecc1faa3510c186d2f00c5.html">slibc</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">string_templates_.hpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Contains overloaded templates for some _s-functions defined in <a class="el" href="string_8h.html" title="Contains those _s-functions that are related to strings.">string.h</a>.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="string_8h_source.html">./string.h</a>&quot;</code><br/>
</div>
<p><a href="string__templates___8hpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;rsize_t s1max&gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">errno_t&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="string__templates___8hpp.html#a0c89cb264d58cd861917ba06cd83d8c5">strcpy_s</a> (char(&amp;s1)[s1max], const char *restrict s2)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The strcpy_s template function copies the string <em>s2</em> to <em>s1</em>.  <a href="#a0c89cb264d58cd861917ba06cd83d8c5"></a><br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;rsize_t s1max&gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">errno_t&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="string__templates___8hpp.html#a473e520b9b3336a8796e1f9f28e098d3">strncpy_s</a> (char(&amp;s1)[s1max], const char *restrict s2, rsize_t n)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The strncpy_s template function copies the string <em>s2</em> to <em>s1</em>.  <a href="#a473e520b9b3336a8796e1f9f28e098d3"></a><br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;rsize_t s1max&gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">errno_t&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="string__templates___8hpp.html#ac67b0a45551b7b4ca8bb38e7a009e691">strcat_s</a> (char(&amp;s1)[s1max], const char *restrict s2)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The strcat_s template function copies the string <em>s2</em> to the end of <em>s1</em>.  <a href="#ac67b0a45551b7b4ca8bb38e7a009e691"></a><br/></td></tr>
<tr><td class="memTemplParams" colspan="2">template&lt;rsize_t s1max&gt; </td></tr>
<tr><td class="memTemplItemLeft" align="right" valign="top">errno_t&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="string__templates___8hpp.html#a406937d6abe4c8cd48cb98cd0de85588">strncat_s</a> (char(&amp;s1)[s1max], const char *restrict s2, rsize_t n)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The strncat_s template function copies not more than <em>n</em> characters of the string <em>s2</em> to the end of <em>s1</em>.  <a href="#a406937d6abe4c8cd48cb98cd0de85588"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Contains overloaded templates for some _s-functions defined in <a class="el" href="string_8h.html" title="Contains those _s-functions that are related to strings.">string.h</a>. </p>
<p>The usage of these templates is restricted to C++. this file is included automatically, if the macro _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES is defined. It's not necessary to declare the size of the destination buffer, when the overloaded functions are available (only if the compiler can calculate the size automatically).</p>
<p>The overloaded templates make the _s-functions easier to use. Buffer sizes, which are declared in the _s-functions, are already known at compilation time. This can be used by C++ templates.</p>
<p>Usage Example: </p>
<div class="fragment"><pre class="fragment">         <span class="keywordtype">char</span> buf[10];
         <span class="keywordtype">char</span> *input = <span class="stringliteral">&quot;123456789ABCDEF&quot;</span>;
         <span class="comment">// ContstraintHandler is called, because the input </span>
         <span class="comment">// contains more than 10 characters</span>
         <a class="code" href="string_8h.html#a8328d88ab6bc728a5d2768340470a86c" title="The strcpy_s function copies the string s2 to s1.">strcpy_s</a>(buf, input)
</pre></div><p> As you can see it's not necessary to explicitly declare the size-parameter (usually one has to write strcpy_s(buf, sizeof(buf), input)). This feature enhances the useability (less to write) and the migration process to the new _s-functions. </p>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="ac67b0a45551b7b4ca8bb38e7a009e691"></a><!-- doxytag: member="string_templates_.hpp::strcat_s" ref="ac67b0a45551b7b4ca8bb38e7a009e691" args="(char(&amp;s1)[s1max], const char *restrict s2)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;rsize_t s1max&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">errno_t <a class="el" href="string__templates___8hpp.html#ac67b0a45551b7b4ca8bb38e7a009e691">strcat_s</a> </td>
          <td>(</td>
          <td class="paramtype">char(&amp;)&#160;</td>
          <td class="paramname"><em>s1</em>[s1max], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *restrict&#160;</td>
          <td class="paramname"><em>s2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The strcat_s template function copies the string <em>s2</em> to the end of <em>s1</em>. </p>
<p>For statically allocated destination buffers this C++ template function automatically deducts <em>strcat_s'</em> size argument <em>s1max</em>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">s1</td><td>The destination buffer </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">s2</td><td>The source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if there was no runtime-constraint violation. Otherwise a non-zero value is returned. </dd></dl>

<p>References <a class="el" href="string_8h.html#ae3341e764378a4641f16890366c4e213">strcat_s()</a>.</p>

</div>
</div>
<a class="anchor" id="a0c89cb264d58cd861917ba06cd83d8c5"></a><!-- doxytag: member="string_templates_.hpp::strcpy_s" ref="a0c89cb264d58cd861917ba06cd83d8c5" args="(char(&amp;s1)[s1max], const char *restrict s2)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;rsize_t s1max&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">errno_t <a class="el" href="string__templates___8hpp.html#a0c89cb264d58cd861917ba06cd83d8c5">strcpy_s</a> </td>
          <td>(</td>
          <td class="paramtype">char(&amp;)&#160;</td>
          <td class="paramname"><em>s1</em>[s1max], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *restrict&#160;</td>
          <td class="paramname"><em>s2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The strcpy_s template function copies the string <em>s2</em> to <em>s1</em>. </p>
<p>For statically allocated destination buffers this C++ template function automatically deducts <em>strcpy_s'</em> size argument <em>s1max</em>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">s1</td><td>The destination buffer </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">s2</td><td>The source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if there was no runtime-constraint violation. Otherwise a non-zero value is returned. </dd></dl>

<p>References <a class="el" href="string_8h.html#a8328d88ab6bc728a5d2768340470a86c">strcpy_s()</a>.</p>

</div>
</div>
<a class="anchor" id="a406937d6abe4c8cd48cb98cd0de85588"></a><!-- doxytag: member="string_templates_.hpp::strncat_s" ref="a406937d6abe4c8cd48cb98cd0de85588" args="(char(&amp;s1)[s1max], const char *restrict s2, rsize_t n)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;rsize_t s1max&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">errno_t <a class="el" href="string__templates___8hpp.html#a406937d6abe4c8cd48cb98cd0de85588">strncat_s</a> </td>
          <td>(</td>
          <td class="paramtype">char(&amp;)&#160;</td>
          <td class="paramname"><em>s1</em>[s1max], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *restrict&#160;</td>
          <td class="paramname"><em>s2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">rsize_t&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The strncat_s template function copies not more than <em>n</em> characters of the string <em>s2</em> to the end of <em>s1</em>. </p>
<p>For statically allocated destination buffers this C++ template function automatically deducts <em>strncat_s'</em> size argument <em>s1max</em>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">s1</td><td>The destination buffer </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">s2</td><td>The source string </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>Maximum amount of characters that should be copied. (If <em>s2</em> is shorter than <em>n</em>, less bytes are copied) </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if there was no runtime-constraint violation. Otherwise a non-zero value is returned. </dd></dl>

<p>References <a class="el" href="string_8h.html#a37d94a5d2fb891d453ae0a7c6bf13623">strncat_s()</a>.</p>

</div>
</div>
<a class="anchor" id="a473e520b9b3336a8796e1f9f28e098d3"></a><!-- doxytag: member="string_templates_.hpp::strncpy_s" ref="a473e520b9b3336a8796e1f9f28e098d3" args="(char(&amp;s1)[s1max], const char *restrict s2, rsize_t n)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;rsize_t s1max&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">errno_t <a class="el" href="string__templates___8hpp.html#a473e520b9b3336a8796e1f9f28e098d3">strncpy_s</a> </td>
          <td>(</td>
          <td class="paramtype">char(&amp;)&#160;</td>
          <td class="paramname"><em>s1</em>[s1max], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *restrict&#160;</td>
          <td class="paramname"><em>s2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">rsize_t&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The strncpy_s template function copies the string <em>s2</em> to <em>s1</em>. </p>
<p>For statically allocated destination buffers this C++ template function automatically deducts <em>strncpy_s'</em> size argument <em>s1max</em>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">s1</td><td>The destination buffer </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">s2</td><td>The source string </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>Maximum amount of characters that should be copied. (If <em>s2</em> is shorter than <em>n</em>, less bytes are copied)</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if there was no runtime-constraint violation. Otherwise a non-zero value is returned. </dd></dl>

<p>References <a class="el" href="string_8h.html#ac6982f578dbc46c470864f175289fec0">strncpy_s()</a>.</p>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 31 2012 13:48:20 for slibc by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
